<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <form action="calc/m1" method="post">
        <h1>计算器</h1>
        数字1: <input name="num1" type="text"><br>
        数字2: <input name="num2" type="text"><br>

        <!--选择器需要指定 name 和每个属性对应的 value，这样才能传给后端-->
       <select name = "method">
           <option value = "+" selected = "selected">+</option>
           <option value = "-">-</option>
           <option value = "*">*</option>
           <option value = "/">/</option>
        </select>
        <input type="submit" value=" 进行计算 ">
    </form>
    
    <!-- <script>
        function calc() {
            $.ajax({
                type : "POST",
                url : "/calc/m1",
                data : {
                    num1 : $("#num1").val,
                    num2 : $("#num1").val,
                    method : $("#selected").val
                }
            });
        }
    </script> -->
</body>

</html>